package day05;

import java.util.Arrays;

public class MaxOfArray {
    public static void main(String[] args) {
        int[] arr= new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i]= (int)(Math.random()*100+1);
            System.out.print(arr[i]+" ");

        }
        System.out.println();

        //数组的排序
        Arrays.sort(arr);

        for (int i = arr.length-1; i >= 0; i--) {
            System.out.print(arr[i]+" ");
        }

        System.out.println();
        int sum=arr[0];
        int max = arr[0];
        int min = arr[0];
        int count =1;
        for (int i = 1; i < arr.length; i++) {
            sum+=arr[i];
            if (arr[i]>max){
                max = arr[i];
            }
            if (arr[i]<min){
                min=arr[i];
            }
            count++;
        }
        double pin =1.0*sum/count;
        System.out.println("Max:"+max+", Min:"+min+", sum:"+sum+", count:"+count+", pin:"+pin);











    }
}
